package com.aiju.cash.core.api;

import com.aiju.app.config.ConfigManager;
import com.aiju.utils.L;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

/**
 * @author: 佐为
 * @date: 2017-01-07 16:36
 * @version: V1.0
 * @Description: 版本
 */
public class ProductApi {
    private String checkVersion = ConfigManager.INIT_SERVER_HOST + "/product/checkVersion";
    private String download = ConfigManager.INIT_SERVER_HOST + "/product/download";

    /**
     * 检测版本接口
     *
     * @param type     类型 1：安卓 2：ISO
     * @param token    令牌
     * @param callback
     */
    public void checkVersion(String type, String token, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(checkVersion)
                .addParams("type", type)
                .addParams("token", token)
                .build()
                .execute(callback);
    }

    /**
     * 产品下载接口
     *
     * @param type     类型 1：安卓 2：ISO
     * @param token    令牌
     * @param callback
     */
    public void download(String name, String version, String type, String token, StringCallback callback) {
        L.d(name+version);
        OkHttpUtils
                .post()
                .url(download)
                .addParams("name", name)
                .addParams("version", version)
                .addParams("type", type)
                .addParams("token", token)
                .build()
                .execute(callback);
    }
}
